//
//  GameView.cpp
//  Seek&Hide
//
//  Created by 齐思 陈 on 13-10-5.
//
//

#include "GameView.h"
#include "BackgroundLayer.h"
#include "ActionLayer.h"
#include "BlackSmokeLayer.h"

F_SYNTHESIZE_IMPLEMENT(BackgroundLayer*, m_pBackgroundLayer, BackgroundLayer, GameView);
F_SYNTHESIZE_IMPLEMENT(ActionLayer*, m_pActionLayer, ActionLayer, GameView);
F_SYNTHESIZE_IMPLEMENT(BlackSmokeLayer*, m_pBlackSmokeLayer, BlackSmokeLayer, GameView);

GameView::GameView() : m_pActionLayer(NULL), m_pBlackSmokeLayer(NULL), m_pBackgroundLayer(NULL) {
}

GameView::~GameView() {
    
    CC_SAFE_RELEASE(m_pActionLayer);
    CC_SAFE_RELEASE(m_pBackgroundLayer);
    CC_SAFE_RELEASE(m_pBlackSmokeLayer);
}

GameView* GameView::create() {
	GameView* pRet = new GameView();
	pRet->init();
	pRet->autorelease();
	return pRet;
}

bool GameView::init() {

	if ( !CCLayer::init() ) {
		 return false;
	}

    setBackgroundLayer(BackgroundLayer::create());
    setActionLayer(ActionLayer::create());
    setBlackSmokeLayer(BlackSmokeLayer::create());
    
    addChild(getBackgroundLayer(), -10);
    addChild(getActionLayer(), 0);
    addChild(getBlackSmokeLayer(), 10);
    
	return true;
}

void GameView::update(float dt)
{
    
}

